main(n,r){for(r=0;~scanf("%d",&n);r+=n*n);printf("%d",r%10);}
